﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace E1_eMart.admin
{
    public partial class producttype_management : System.Web.UI.Page
    {
        protected List<LoaiSanPham> listLSP = new List<LoaiSanPham>();
        protected void Page_Load(object sender, EventArgs e)
        {
            DataClasses1DataContext edata = new DataClasses1DataContext();
            listLSP = edata.LoaiSanPhams.ToList<LoaiSanPham>();
        }

        // Apply
        protected void Button2_Click(object sender, EventArgs e)
        {
            if (TenSP.Text.Equals("") || MaSP.Text.Equals(""))
                return;
            DataClasses1DataContext edata = new DataClasses1DataContext();
            try
            {
                LoaiSanPham lsp = new LoaiSanPham();
                lsp.TenLoaiSanPham = TenSP.Text;
                lsp.MaLoaiSanPham = int.Parse(MaSP.Text);
                edata.LoaiSanPhams.InsertOnSubmit(lsp);
                edata.SubmitChanges();
                Response.Redirect("producttype_management.aspx");
            }
            catch (Exception ex)
            {
            }
        }

        // Delete
        protected void Button1_Click(object sender, EventArgs e)
        {

        }
    }
}